<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:replace="userCommon::common-header">
  <title>器械状态</title>
</head>

<body class="sb-nav-fixed">
<nav th:replace="userCommon :: common-navbar"></nav>

<div id="layoutSidenav">
  <div th:replace="userCommon :: common-sidenav"></div>

  <div id="layoutSidenav_content">
    <main>
      <div class="container-fluid px-4">
        <h1 class="mt-4">器械状态</h1>
        <ol class="breadcrumb mb-4">
          <li class="breadcrumb-item"><a th:href="@{/toUserMain}">主页</a></li>
          <li class="breadcrumb-item active">器械状态</li>
        </ol>


        <!-- 器械状态表格 -->
        <div class="card mb-4">
          <div class="card-header">
            <i class="fas fa-table me-1"></i>
            器材信息表
          </div>
          <div class="card-body">
            <table id="datatablesSimple">
              <thead>
              <tr>
                <th>器械ID</th>
                <th>名称</th>
                <th>位置</th>
                <th>状态</th>
                <th>备注</th>
              </tr>
              </thead>
              <tbody>
              <tr th:if="${equipmentList == null || equipmentList.isEmpty()}">
                <td colspan="5" class="text-center text-muted">暂无器械信息</td>
              </tr>
              <tr th:each="equipment : ${equipmentList}">
                <td th:text="${equipment.equipmentId}"></td>
                <td th:text="${equipment.equipmentName}"></td>
                <td th:text="${equipment.equipmentLocation}"></td>
                <td>
                  <span th:if="${equipment.equipmentStatus == '正常'}" class="badge bg-success">正常</span>
                  <span th:if="${equipment.equipmentStatus == '维修中'}" class="badge bg-warning">维修中</span>
                  <span th:if="${equipment.equipmentStatus == '损坏'}" class="badge bg-danger">损坏</span>
                </td>
                <td th:text="${equipment.equipmentMessage}"></td>
              </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <br><br><br><br>

    </main>

    <footer th:replace="userCommon::common-footer"></footer>
  </div>
</div>

<!-- 页脚脚本 -->
<div th:replace="userCommon :: common-scripts"></div>

<script>
  // 初始化DataTables
  document.addEventListener('DOMContentLoaded', function() {
    const table = document.getElementById('datatablesSimple');
    if (table) {
      new simpleDatatables.DataTable(table);
    }
  });
</script>

</body>
</html>